package edu.cuit.canary.admin.controller;

import edu.cuit.canary.commons.oss.service.FileService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/files")
public class FileController {
    @Resource private FileService fileService;

    @RequestMapping("/upload")
    public String upload(MultipartFile avatar) throws IOException {
        return fileService.uploadImageFile(avatar.getOriginalFilename(), avatar.getContentType(), avatar.getInputStream());
    }
}
